SET(CUDA_ARCH "sm_10" CACHE STRING "CUDA architecture")
SET_PROPERTY(CACHE CUDA_ARCH PROPERTY STRINGS sm_10 sm_11 sm_20 sm_21 none)
IF(NOT (${CUDA_ARCH} STREQUAL none))
    SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};;-arch=${CUDA_ARCH}")
ENDIF()
OPTION(CUDA_PTXAS_VERBOSE "Show ptxas verbose information" OFF)
IF(${CUDA_PTXAS_VERBOSE})
    SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};;--ptxas-options=-v")
ENDIF()
FIND_PACKAGE(CUDA 4.0 REQUIRED)

IF(WIN32)
    IF(CMAKE_CL_64)
        SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64")
    ELSE()
        SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib/Win32")
    ENDIF()
ELSEIF(APPLE)
    SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib")
ELSE()
    IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
        SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib64")
    ELSE()
        SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib")
    ENDIF()
ENDIF()
FIND_LIBRARY(CUDA_npp_LIBRARY npp HINTS "${CUDA_LIB_DIR}")
FIND_LIBRARY(CUDA_curand_LIBRARY curand HINTS "${CUDA_LIB_DIR}")
